/**
 * 
 */
package com.netflexitysolutions.amazonws.sdb.orm.internal.generator;

import java.io.IOException;
import java.util.Map;

import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;

import freemarker.template.Configuration;
import freemarker.template.TemplateException;

/**
 * @author netflexity
 *
 */
public class FreemarkerTemplateManager {

	private Configuration configuration;
	
	/**
	 * @param templateName
	 * @param model
	 * @return
	 * @throws TemplateException
	 * @throws IOException
	 */
	public String getTemplateContent(String templateName, Map<String, Object> model) throws TemplateException, IOException{
		return FreeMarkerTemplateUtils.processTemplateIntoString(configuration.getTemplate(templateName), model);
	}

	/**
	 * @return the configuration
	 */
	public Configuration getConfiguration() {
		return configuration;
	}

	/**
	 * @param configuration the configuration to set
	 */
	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}
}
